home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Codigo / Control del ratón / MouseCursorsProperty / MouseCursorsProperty.cs next >
Encoding:
Text File  |  2002-04-18  |  2.9 KB  |  69 lines

  1. //---------------------------------------------------
  2. // MouseCursorsProperty.cs ⌐ 2001 by Charles Petzold
  3. //---------------------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Windows.Forms;
  7.  
  8. class MouseCursorsProperty: Form
  9. {
  10.      Label[] acntl = new Label[28];
  11.  
  12.      public static void Main()
  13.      {
  14.           Application.Run(new MouseCursorsProperty());
  15.      }
  16.      public MouseCursorsProperty()
  17.      {
  18.           Cursor[] acursor = 
  19.           { 
  20.                Cursors.AppStarting, Cursors.Arrow,       Cursors.Cross,       
  21.                Cursors.Default,     Cursors.Hand,        Cursors.Help,     
  22.                Cursors.HSplit,      Cursors.IBeam,       Cursors.No,          
  23.                Cursors.NoMove2D,    Cursors.NoMoveHoriz, Cursors.NoMoveVert,
  24.                Cursors.PanEast,     Cursors.PanNE,       Cursors.PanNorth,    
  25.                Cursors.PanNW,       Cursors.PanSE,       Cursors.PanSouth,
  26.                Cursors.PanSW,       Cursors.PanWest,     Cursors.SizeAll,     
  27.                Cursors.SizeNESW,    Cursors.SizeNS,      Cursors.SizeNWSE,
  28.                Cursors.SizeWE,      Cursors.UpArrow,     Cursors.VSplit,      
  29.                Cursors.WaitCursor
  30.           };
  31.           string[] astrCursor = 
  32.           { 
  33.                "AppStarting",       "Arrow",             "Cross",       
  34.                "Default",           "Hand",              "Help",     
  35.                "HSplit",            "IBeam",             "No",          
  36.                "NoMove2D",          "NoMoveHoriz",       "NoMoveVert",
  37.                "PanEast",           "PanNE",             "PanNorth",    
  38.                "PanNW",             "PanSE",             "PanSouth",
  39.                "PanSW",             "PanWest",           "SizeAll",     
  40.                "SizeNESW",          "SizeNS",            "SizeNWSE",
  41.                "SizeWE",            "UpArrow",           "VSplit",      
  42.                "WaitCursor" 
  43.           };
  44.  
  45.           Text = "Cursores del rat≤n con la propiedad Cursor";
  46.  
  47.           for (int i = 0; i < 28; i++)
  48.           {
  49.                acntl[i] = new Label();
  50.                acntl[i].Parent = this;
  51.                acntl[i].Text = astrCursor[i];
  52.                acntl[i].Cursor = acursor[i]; 
  53.                acntl[i].BorderStyle = BorderStyle.FixedSingle;
  54.           }
  55.          OnResize(EventArgs.Empty);
  56.      }
  57.      protected override void OnResize(EventArgs ea)
  58.      {
  59.           for (int i = 0; i < acntl.Length; i++)
  60.           {
  61.                acntl[i].Bounds = Rectangle.FromLTRB(
  62.                                         (i % 4    ) * ClientSize.Width  / 4, 
  63.                                         (i / 4    ) * ClientSize.Height / 7,
  64.                                         (i % 4 + 1) * ClientSize.Width  / 4, 
  65.                                         (i / 4 + 1) * ClientSize.Height / 7);
  66.           }
  67.      }
  68. }
  69.